package com.hnou.boxuegu.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

public class UtilsHelper {
    public static boolean isExistUserName(Context context,String userName){
        boolean has_userName=false;
        SharedPreferences sp=context.getSharedPreferences("loginInfo",Context.MODE_PRIVATE);
        String spPsw=sp.getString(userName,"");
        if(!TextUtils.isEmpty(spPsw)){
            has_userName=true;
        }
                return has_userName;
    }
    public static void saveUserInfo(Context context,String userName,String password){
        String md5Psw=MD5Utils.md5(password);
        SharedPreferences sp=context.getSharedPreferences("loginInfo",Context.MODE_PRIVATE);

        SharedPreferences.Editor edit=sp.edit();
        edit.putString(userName,md5Psw);
        edit.commit();
    }
}
